<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Tree="clr-namespace:TreeListControl.Tree" xmlns:local="clr-namespace:TreeListControl.Themes">

    <local:ConvertTreeViewLine x:Key="LineConverter" />
    <SolidColorBrush x:Key="GlyphBrush"
                     Color="#444" />
    
    <Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
		<Setter Property="Focusable" Value="False"/>
		<Setter Property="Width" Value="19"/>
		<Setter Property="Height" Value="13"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="ToggleButton">
					<Border Background="#00FFFFFF" Width="19" Height="13">
						<Border BorderThickness="1,1,1,1" CornerRadius="1,1,1,1" BorderBrush="#FF7898B5" Width="9" Height="9" SnapsToDevicePixels="True">
							<Border.Background>
								<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
									<LinearGradientBrush.GradientStops>
										<GradientStop Color="#FFFFFFFF" Offset="0.2" />
										<GradientStop Color="#FFC0B7A6" Offset="1" />
									</LinearGradientBrush.GradientStops>
								</LinearGradientBrush>
							</Border.Background>
							<Path Data="M0,2L0,3 2,3 2,5 3,5 3,3 5,3 5,2 3,2 3,0 2,0 2,2z" Fill="#FF000000" Name="ExpandPath" Margin="1,1,1,1" />
						</Border>
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="ToggleButton.IsChecked" Value="True">
							<Setter Property="Path.Data" TargetName="ExpandPath">
								<Setter.Value>
									<StreamGeometry>M0,2L0,3 5,3 5,2z</StreamGeometry>
								</Setter.Value>
							</Setter>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
    
	<Tree:LevelToIndentConverter x:Key="LevelToIndentConverter"/>
	<Tree:CanExpandConverter x:Key="CanExpandConverter"/>

	<Style TargetType="{x:Type Tree:RowExpander}">
		<Setter Property="Focusable" Value="False"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Tree:RowExpander}">
					<ToggleButton x:Name="Expander" 
									  Style="{StaticResource ExpandCollapseToggleStyle}" 
									  Margin="{Binding Node.Level, Converter={StaticResource LevelToIndentConverter},RelativeSource={RelativeSource AncestorType={x:Type Tree:TreeListItem}}}"
									  IsChecked="{Binding Node.IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type Tree:TreeListItem}}}"
									  Visibility="{Binding Node.IsExpandable, Converter={StaticResource CanExpandConverter},RelativeSource={RelativeSource AncestorType={x:Type Tree:TreeListItem}}}"
									  ClickMode="Press"/>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>
